import os,re
os.environ['DJANGO_SETTINGS_MODULE'] = 'drf2.settings'
import django
django.setup()
from django.conf import settings

current_url = '/api/v1/roles/'
for valid_url in settings.VALID_URL_LIST:
    if re.match(valid_url, current_url):
        print(111)

permission_list = ['/users/', '/roles/', '/users/', '/rights/', '/users/edit/', '/roles/edit/']
flag = False
for url in permission_list:
    reg = '%s$' % url
    if re.match(reg,current_url):
        print(url)
        flag = True
        break
if not flag:
    print('无权访问')